.drawer-pusher
  = autosaving_form_for @<%= singular_name %> do |f|
    = render 'tenon/shared/default_form_toolbar', obj: @<%= singular_name %>

    %main
<% if attributes.map(&:name).include? 'title' -%>
      = f.title_text_field :title

<% end -%>
<% if text_fields.reject { |f| f.name == 'title' }.present? -%>
      .panel-label Text Fields
      .panel.panel--padded
<% text_fields.reject { |f| f.name == 'title' }.each do |field| -%>
        = f.text_field :<%= field.name %>
<% end -%>
<% end -%>
<% if assets.present? -%>
      .panel-label Assets
<% assets.each do |field| -%>
      = f.asset :<%= field.name %>
<% end -%>

<% end -%>
<% if text_areas.present? -%>
      .panel-label Text Areas
      .panel.panel--padded
<% text_areas.each do |field| -%>
        = f.text_area :<%= field.name %>
<% end -%>

<% end -%>

<% if tenon_contents.present? -%>
      .panel-label Tenon Content Fields
      .panel.panel--padded
<% tenon_contents.each do |field| -%>
        = f.tenon_content :<%= field.name %>
<% end -%>

<% end -%>
<% unless [collections, booleans, dates, numbers, timestamps].flatten.empty? -%>
      .panel-label Details
      .panel.panel--padded
<% collections.each do |c| %>
        = f.collection_select :<%= c %>_id, @<%= c.pluralize %>, :id, :title, prompt: '--'

<% end -%>
<% dates.each do |field| -%>
        = f.date_picker :<%= field.name %>
<% end -%>
<% timestamps.each do |field| -%>
        = f.date_time_picker :<%= field.name %>
<% end -%>
<% booleans.each do |field| %>
        = f.check_box :<%= field.name %>
<% end -%>
<% numbers.each do |field| %>
        = f.number_field :<%= field.name %>
<% end -%>

<% end -%>

<% if attributes.map(&:name).include? 'publish_at' -%>
      .panel-label Publishing
      .panel.panel--padded
        = f.date_time_picker :publish_at, label: 'Publish Date'

<% end -%>
<% if seo_fields.present? -%>
      .panel-label SEO
      .panel.panel--padded
        = render "tenon/shared/seo_fields", :f => f

<% end -%>
    .spacer
